import { Post } from '../../entities/post.entity';
import { Singer } from '../../entities/singer.entity';
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsInt, IsNotEmpty, IsString, Min } from 'class-validator';

export class PostRegisterDto {
  @IsNotEmpty({
    message: '文章标题不能为空',
  })
  @ApiProperty({
    example: '',
    description: '标题名',
  })
  title: string;

  @ApiProperty({
    example: '',
    description: '用户内容',
  })
  content: string;

  @ApiProperty({
    example: '',
    description: '投票项目id',
  })
  pollId: string;
}

export class PagePostItemtDto extends Post {
  @ApiProperty({
    description: '当前页包含数量',
    required: false,
    default: 10,
  })
  @Type(() => Number)
  @IsInt()
  @Min(1)
  readonly pageSize: number = 10;

  @ApiProperty({
    description: '当前页包含数量',
    required: false,
    default: 1,
  })
  @Type(() => Number)
  @IsInt()
  @Min(1)
  readonly pageNo: number = 1;
}
